Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make all-in-one.yaml file independant of sampling-strategies.json file #6431

Merged
merged 13 commits into from
Jan 12, 2025

Conversation

adityachopra29
Copy link
Contributor

Which problem is this PR solving?

Description of the changes

  • Removed the hardcoded path in the default configuration (all-in-one.yaml).
  • updated tests accordingly

How was this change tested?

  • Since some of the tests are using hardcoded services in sampling-strategies.json (the service "foo").

    the sampling-strategies.json file could not be removed
  • Also, right now there are some tests, namely:
    1.) TestServerHTTP_TracesRequest,
    2.) all 3 tests in cmd/query/app
    which are not passing even on the main branch itself (according to me, otherwise I have made some mistake), and hence these same tests are not passing after I made my changes (my changes should not affect them anyway).

Checklist

@adityachopra29 adityachopra29 requested a review from a team as a code owner December 27, 2024 19:35
Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • you are working off a stale main, please rebase. There should be no changes to submodules in your PR
  • you have not made any changes to the logic, so why are you sending this for review?
  • you need to test that sampling endpoint returns expected stratery
$ curl "http://localhost:5778/?service=x"
{"strategyType":0,"probabilisticSampling":{"samplingRate":1}}%

@adityachopra29
Copy link
Contributor Author

Hi @yurishkuro,
Kindly review the PR now.

  • the output is coming correct testing the endpoint
$ curl "http://localhost:5778/?service=x"
{"strategyType":0,"probabilisticSampling":{"samplingRate":0.001}}%
  • I have updated the base main branch
  • no other changes were suggested in logic, hence rest code is same

Copy link

codecov bot commented Dec 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.27%. Comparing base (c7e0b78) to head (e7003d9).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6431      +/-   ##
==========================================
+ Coverage   96.25%   96.27%   +0.02%     
==========================================
  Files         372      372              
  Lines       21276    21280       +4     
==========================================
+ Hits        20479    20488       +9     
+ Misses        609      605       -4     
+ Partials      188      187       -1     
Flag Coverage Δ
badger_v1 10.68% <ø> (ø)
badger_v2 2.78% <ø> (ø)
cassandra-4.x-v1-manual 16.58% <ø> (ø)
cassandra-4.x-v2-auto 2.71% <ø> (ø)
cassandra-4.x-v2-manual 2.71% <ø> (ø)
cassandra-5.x-v1-manual 16.58% <ø> (ø)
cassandra-5.x-v2-auto 2.71% <ø> (ø)
cassandra-5.x-v2-manual 2.71% <ø> (ø)
elasticsearch-6.x-v1 20.26% <ø> (+<0.01%) ⬆️
elasticsearch-7.x-v1 20.32% <ø> (ø)
elasticsearch-8.x-v1 20.48% <ø> (-0.01%) ⬇️
elasticsearch-8.x-v2 2.77% <ø> (-0.01%) ⬇️
grpc_v1 12.20% <ø> (ø)
grpc_v2 9.04% <ø> (+<0.01%) ⬆️
kafka-3.x-v1 10.36% <ø> (ø)
kafka-3.x-v2 2.78% <ø> (ø)
memory_v2 2.77% <ø> (-0.01%) ⬇️
opensearch-1.x-v1 20.38% <ø> (ø)
opensearch-2.x-v1 20.37% <ø> (ø)
opensearch-2.x-v2 2.78% <ø> (+<0.01%) ⬆️
tailsampling-processor 0.51% <ø> (ø)
unittests 95.15% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

yurishkuro added a commit that referenced this pull request Dec 30, 2024
## Which problem is this PR solving?
- Accidentally stumbled upon this when looking at #6431
- Turns out v2 config did not support all the options from v1

## Description of the changes
- Add support for reload interval

## How was this change tested?
`go run ./cmd/jaeger`

```
$ curl "http://localhost:5778/?service=x"
{"strategyType":0,"probabilisticSampling":{"samplingRate":1}}%
```

Edit cmd/jaeger/sampling-strategies.json to change default to 0.1.

Observe server logs showing new values.

```
$ curl "http://localhost:5778/?service=x"
{"strategyType":0,"probabilisticSampling":{"samplingRate":0.1}}%
```

---------

Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
@yurishkuro
Copy link
Member

$ docker run -p 5778:5778 jaegertracing/jaeger:2.1.0

$ curl "http://localhost:5778/?service=x"
{"strategyType":0,"probabilisticSampling":{"samplingRate":1}}%

The current default behavior is to return probability 1.0, not 0.001.

There is a hardcoded constant defaultSamplingProbability = 0.001, but we don't want to change it because jaeger-v1 should still be using that, so we need to make that value configurable in the static/provider

@yurishkuro
Copy link
Member

make sure to pull from remote branch before you continue work, to pick up the changes I made

@adityachopra29
Copy link
Contributor Author

adityachopra29 commented Dec 30, 2024

Okay. So the initial issue regarding the dependancy of sampling-strategies.json file in all-in-one.yaml is resolved right? This is a new issue which needs to be solved?
To make SamplingRate configurable in static/provider, keeping defaultSamplingProbability const?
If yes, then I plan on implementing this by creating a factor (with default value 1000), which I will multiply defaultSamplingProbability with when returning SamplingRate. Am I on the right track?

@yurishkuro
Copy link
Member

yurishkuro commented Dec 30, 2024

The original issue is not resolved since these changes return different results from what v2.1.0 Jaeger container returns.

There is no need for any multiplier, the default probability should be made parameterizable via the provider API so that we can pass it from jaeger-v2 sampling extension (see #6441 for the pattern).

@adityachopra29
Copy link
Contributor Author

@yurishkuro Please have a look once now.

  • A parameter for DefaultSamplingProbability has been created which can be filled using a flag, or using the yaml file input default_sampling_probability.
  • A flag called "sampling.stategies-default-sampling-probability" has been created for the same
  • If no input is given for DefaultSamplingProbability, it defaults to "defaultDefaultSamplingProbability" = 0.001. (which was originally used)
  • DefaultSamplingProbability has been given value 0.001 in all-in-one.yaml (to give the default value as before)
  • In all the tests given in the provider_test.go file, initially they used defaultSamplingProbability = 0.001. Since now this parameterized, I have used the value of defaultDefaultSamplingProbability = 0.001 instead now to keep the default behavior.
  • Since no changes have been made to the original defaultSamplingProbability variable, the output still comes as follows:
 curl "http://localhost:5778/?service=x"
{"strategyType":0,"probabilisticSampling":{"samplingRate":0.001}}%  

Instead of

{"strategyType":0,"probabilisticSampling":{"samplingRate":1}}%  

whch you wanted. I wanted to confirm what change I have to do to set this.

Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove idl submodule change

cmd/jaeger/internal/extension/remotesampling/config.go Outdated Show resolved Hide resolved
cmd/jaeger/internal/extension/remotesampling/config.go Outdated Show resolved Hide resolved
cmd/jaeger/internal/all-in-one.yaml Outdated Show resolved Hide resolved
Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on the right track

plugin/sampling/strategyprovider/static/options.go Outdated Show resolved Hide resolved
plugin/sampling/strategyprovider/static/options.go Outdated Show resolved Hide resolved
plugin/sampling/strategyprovider/static/provider.go Outdated Show resolved Hide resolved
Manik2708 pushed a commit to Manik2708/jaeger that referenced this pull request Jan 5, 2025
## Which problem is this PR solving?
- Accidentally stumbled upon this when looking at jaegertracing#6431
- Turns out v2 config did not support all the options from v1

## Description of the changes
- Add support for reload interval

## How was this change tested?
`go run ./cmd/jaeger`

```
$ curl "http://localhost:5778/?service=x"
{"strategyType":0,"probabilisticSampling":{"samplingRate":1}}%
```

Edit cmd/jaeger/sampling-strategies.json to change default to 0.1.

Observe server logs showing new values.

```
$ curl "http://localhost:5778/?service=x"
{"strategyType":0,"probabilisticSampling":{"samplingRate":0.1}}%
```

---------

Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
@adityachopra29
Copy link
Contributor Author

@yurishkuro I have made the changes. Please have a look.
Also, I found that defaultSamplingProbability was not being used anywhere, except in the provider tests(which I replaced with DefaultDefaultSamplingProbability,as you can see. So I removed it.

@yurishkuro
Copy link
Member

please ensure all commits a signed.

@adityachopra29
Copy link
Contributor Author

@yurishkuro done .... some old commits were missing the signoff

@@ -30,7 +30,8 @@ extensions:
remote_sampling:
# We can either use file or adaptive sampling strategy in remote_sampling
file:
path: ./cmd/jaeger/sampling-strategies.json
path:
default_sampling_probability: 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense as a field at the top level? Right now we have file.default_sampling_probability and adaptive.initial_sampling_probability, but their meaning is very similar - which probability to return in the absence of any better information.

Copy link
Contributor Author

@adityachopra29 adityachopra29 Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes ...it makes sense to remove redundancy. As I understand, this can have a drawback if the adaptive sampling probability is different from static samlping probability. (Just like right now, the defaultSamplingProbability was defined to be 0.001 as used by jaegerV1, but the initial_sampling_probability for adaptive sampling is given value 0.1 in yaml file).
Will this be an issue in the future or should I make the relevant changes?

@yurishkuro yurishkuro enabled auto-merge (squash) January 12, 2025 00:48
@yurishkuro yurishkuro merged commit 97a9f06 into jaegertracing:main Jan 12, 2025
54 checks passed
ekefan pushed a commit to ekefan/jaeger that referenced this pull request Jan 14, 2025
jaegertracing#6431)

## Which problem is this PR solving?
- fix jaegertracing#6338 

## Description of the changes
- Removed the hardcoded path in the default configuration
(all-in-one.yaml).
- updated tests accordingly

## How was this change tested?
- Since some of the tests are using hardcoded services in
```sampling-strategies.json``` (the service "foo").

https://github.com/jaegertracing/jaeger/blob/b02900cd99b38a79f70d9ba14f631307ded84764/cmd/jaeger/internal/extension/remotesampling/extension_test.go#L83
the ```sampling-strategies.json``` file could not be removed
- Also, right now there are some tests, namely:
1.) TestServerHTTP_TracesRequest,
2.) all 3 tests in cmd/query/app
which are not passing even on the main branch itself (according to me,
otherwise I have made some mistake), and hence these same tests are not
passing after I made my changes (my changes should not affect them
anyway).


## Checklist
- [X] I have read
https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md
- [X] I have signed all commits
- [ ] I have added unit tests for the new functionality
- [X] I have run lint and test steps successfully
  - for `jaeger`: `make lint test`
  - for `jaeger-ui`: `npm run lint` and `npm run test`

---------

Signed-off-by: adityachopra29 <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
@adityachopra29 adityachopra29 deleted the fix-sampling-config branch January 15, 2025 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug]: v2 all-in-one binary cannot find sampling strategies file
2 participants